<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button style="width:100px;height:60px">点我试试</button>
</body>
<script>
    function throttle(fn,wait=500){
        let flag = false
        return function(...args){
            if(flag){
                return
            }else{
                flag = true
                setTimeout(()=>{
                    fn.apply(this,args)
                    flag = false  
                },wait)
            }
        }
    }
    let btn = document.querySelector('button')
    btn.onclick = throttle(function(){
        console.log(1);
    },200)
</script>
</html>